<?php

date_default_timezone_set('Europe/Chisinau');
mb_internal_encoding("UTF-8");

// Utf-8 validator fix for russian characters
CValidator::$builtInValidators['length'] = 'Utf8StringValidator';

return array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=>'MJ Testing',

	// preloading 'log' component
	'preload'=>array('log'),

	// autoloading model and component classes
	'import'=>array(
		'application.models.*',
		'application.components.*',

        'application.modules.user.UserModule',
        'application.modules.user.models.*',
        'application.modules.user.components.*',
	),

	'modules'=>array(
		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'2011',
		 	// If removed, Gii defaults to localhost only. Edit carefully to taste.
			'ipFilters'=>array('127.0.0.1','::1'),
		),
        'user'=>array(
            'returnUrl'=>'/site/index',
        ),
        'blog',
        //'admin',
	),

	// application components
	'components'=>array(
		'user'=>array(
                // enable cookie-based authentication
                'allowAutoLogin'=>true,
                'loginUrl' => array('/user/login'),
        ),
		'urlManager'=>array(
			'showScriptName'=>false,
			'urlFormat'=>'path',
			'rules'=>array(
                'gii'=>'gii',
            	'gii/<controller:\w+>'=>'gii/<controller>',
            	'gii/<controller:\w+>/<action:\w+>'=>'gii/<controller>/<action>',

                'user'=>'user',
            	'user/<controller:\w+>'=>'user/<controller>',
            	'user/<controller:\w+>/<action:\w+>'=>'user/<controller>/<action>',

                'blog'=>'blog/post',
                'blog/post/<id:\d+>/<title:.*?>'=>'blog/post/view',
        		'blog/posts/<tag:.*?>'=>'blog/post/index',
            	'blog/<controller:\w+>'=>'blog/<controller>',
            	'blog/<controller:\w+>/<action:\w+>'=>'blog/<controller>/<action>',

                'jobs'=>'job/index',
        		'jobs/<tags:.*?>'=>'job/index',
                'job/<id:\d+>/<title:.*?>'=>'job/view',

                'resume'=>'resume/index',
                'resume/<id:\d+>/<title:.*?>'=>'resume/view',

                '' => 'site/index',
		        '<name:\w+>'=>array('site/static', 'urlSuffix'=>'.html'),

                //=== Default routing ===
				'<controller:\w+>/<id:\d+>'=>'<controller>/view',
				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
			),
		),
		'db'=>array(
			'connectionString'=>'mysql:host=localhost;dbname=mj_dev',
			'emulatePrepare'=>true,
			'username'=>'root',
			'password'=>'',
			'charset'=>'utf8',
            'tablePrefix'=>'mj_',

		    'schemaCachingDuration' => (YII_DEBUG) ? 0 : 259200 // 3x Days
		),
        'cache'=>array('class' => 'system.caching.'.(YII_DEBUG) ? 'CFileCache' : 'CDummyCache'),
        
		'errorHandler'=>array(
			// use 'site/error' action to display errors
            'errorAction'=>'site/error',
        ),
		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning',
				),
				// uncomment the following to show log messages on web pages
				//array(
				//	'class'=>'CWebLogRoute',
				//),
			),
		),
	),

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params'=>array(
		// this is used in contact page
		'adminEmail'=>'ngreduce@gmail.com',
        'defaultLang'=>'ru',
        
        'itemsPerPage'=>15,
        'commentNeedApproval'=>true,
        'itemsNeedApproval'=>true,

        'legacyDb'=>array(
            'jobs'=>array(
                'connectionString'=>'mysql:host=localhost;dbname=mj_src',
    			'emulatePrepare'=>true,
	    		'username'=>'root',
		    	'password'=>'',
			    'charset'=>'utf8',
            ),
            'resume'=>array(
                'connectionString'=>'mysql:host=localhost;dbname=mj_src',
    			'emulatePrepare'=>true,
	    		'username'=>'root',
		    	'password'=>'',
			    'charset'=>'utf8',
            )
        ),
	),
);
